<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initDb()
    {
        $config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini',
            'develop'
        );   
        $db = Zend_Db::factory($config->resources->db);
        $db->query('SET NAMES UTF8');
        Zend_Db_Table_Abstract::setDefaultAdapter($db);
        Zend_Registry::set('db' , $db);
    }
    
    protected function _initAutoload()
    {
        $autoloader = new Zend_Application_Module_Autoloader(
        array(
            'namespace' => '',
            'basePath'  => APPLICATION_PATH
        ));


        $autoloader->addResourceTypes(array(
        'App' => array(
            'path'      =>'/library/App/',
            'namespace' => 'App_',
        ),
        'services' => array(
            'path'      =>'/services/',
            'namespace' => 'Service_',
        )
        ));
        return $autoloader;
    }
   
    protected function _initView()
    {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $layout->setLayout('default');
        $view = $layout->getView();
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8');
        $view->headTitle('Блог программиста');
        $view->headTitle()->setSeparator(' → ');
    }
} 